﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Effects
{
    abstract public class Tween
    {

        /// <summary>
        /// Represents the B variable in an easing tween formula
        /// </summary>
        protected double _startValue;

        /// <summary>
        /// Represents the C variable in an easing tween formula
        /// </summary>
        protected double _changeValue;

        /// <summary>
        /// Represents the D variable in an easing tween formula
        /// </summary>
        protected double _duration;

        /// <summary>
        /// Creates a configurable empty tween
        /// </summary>
        public Tween()
        {
        }

        /// <summary>
        /// Create a tween that will contain a default startTime
        /// </summary>
        /// <param name="duration">The time it takes to tween the animation</param>
        /// <param name="startValue">Contains the value at which the tween starts to work</param>
        /// <param name="changeValue">Value to affect the start value with over time</param>
        public Tween(double duration, double startValue, float changeValue)
        {
            this._duration = duration;
            this._startValue = startValue;
            this._changeValue = changeValue;
        }

        /// <summary>
        /// Computes the values of the tween based on elapsed time
        /// </summary>
        /// <param name="currentTime">Time that as elapsed since the beginning of the operation</param>
        /// <returns>Tweened value</returns>
        public abstract double tweenValue(double currentTime);

        /// <summary>
        /// Gets/Sets the duration of the animation
        /// </summary>
        public double duration
        {
            get
            {
                return this._duration;
            }
            set
            {
                this._duration = value;
            }
        }

        /// <summary>
        /// Gets/Sets the startValue of the tween
        /// </summary>
        public double startValue
        {
            get
            {
                return this._startValue;
            }
            set
            {
                this._startValue = value;
            }
        }

        /// <summary>
        /// Gets/Sets the changeValue of the tween
        /// </summary>
        public double changeValue
        {
            get
            {
                return this._changeValue;
            }
            set
            {
                this._changeValue = value;
            }
        }

    }
}
